<template>
	<view class="" :class="{ light: theme == 'light' }">
		<view class="ptb15 plr10 bdb_1e" v-for="(item,index) in logList" :key="item.id">
			<view class="flex between">
				<text class="ft14 bold redColor">+{{item.value}}</text>
				<text class="gray4">{{item.created_at.substring(10,16)}} {{item.created_at.substring(5,7)}}/{{item.created_at.substring(8,11)}}</text>
			</view>
			<!-- <view class="pt5">{{item.memo}}</view> -->
		</view>
		<view class="tc pt30 pb100" v-if='logList.length==0'>
			<image src="/static/image/nodata.png" class="w50 h120"></image>
			<view class="gray7">{{$t('home.norecord')}}</view>
		</view>
	</view>
</template>

<script>
	import { mapState } from 'vuex';
	export default {
		data() {
			return {
				page:1,
				hasMore:true,
				logList:[]
			}
		},
		computed: {
			...mapState(['theme'])
		},
		onPullDownRefresh() {
			this.page = 1;
			this.getLog();
		},
		onReachBottom() {
			if (!this.hasMore){
				return;
			} 
			this.page++;
			this.getLog();
		},
		onShow() {
			this.$utils.setThemeTop(this.theme);
		},
		onLoad() {
			this.getLog()
		},
		methods: {
			getLog() {
				let that = this;
				let url = 'account_log/change';
				this.$utils.initDataToken({ url: url, data: { type:119, page: this.page, limit: 7 } }, res => {
					uni.stopPullDownRefresh();
					let data = res.data;
					that.logList = that.page == 1 ? data : that.logList.concat(data);
					that.hasMore = res.last_page == res.current_page ? false : true;
				});
			}
		}
	}
</script>

<style>

</style>
